#ifndef DETECTORINTERFACE_H
#define DETECTORINTERFACE_H

#include <QObject>
class QJsonObject;

typedef struct _DetectorSpecifics {
    QString modality;
    QString imageType;
    QString conversionType;
    float pixelWidth;
    float pixelHeight;
    ushort bitsAllocated;
    ushort bitsStored;
    ushort highBit;
    ushort samplesPerPixel;
    int pixelRepresentation;
    int rescaleIntercept;
    float rescaleSlope;
    QString rescaleType;
    QString interpret;
    QString explanation;
    QString processUid;
    QString presentUid;
    _DetectorSpecifics():pixelWidth(0),pixelHeight(0),bitsAllocated(0),bitsStored(0),
        highBit(0),samplesPerPixel(0),pixelRepresentation(0),rescaleIntercept(0),rescaleSlope(0){}
} DetectorSpecifics;

typedef struct _DetectorTransforms {
    bool rotLeft;
    bool rotRight;
    bool flipHori;
    bool flipVert;
    _DetectorTransforms():rotLeft(0),rotRight(0),flipHori(0),flipVert(0){}
} DetectorTransforms;

typedef struct _DetectorConfig {
    QString name;
    QString type;
    QString id;
    QString acqLib;
    DetectorSpecifics specifics;
    DetectorTransforms transform;
} DetectorConfig;

typedef void (*DetectorProc)(const QJsonObject &json, void *userData);

class DetectorInterface
{
public:
    virtual ~DetectorInterface() {}

    virtual QObject *getObject() = 0;
    virtual void setDetectorHook(DetectorProc proc, void *userData) = 0;
    virtual bool getDetectorConfig(DetectorConfig &config) const = 0;
    virtual ushort *getImage(ushort *&img, int &width, int &height) = 0;
    virtual void startCapture(bool start) = 0;
};

#define DetectorPlugin_iid "com.zmg.dr.plugin.detector.v100"
Q_DECLARE_INTERFACE(DetectorInterface, DetectorPlugin_iid)

#endif // DETECTORINTERFACE_H
